Asymptotic Bounds
Tags: #◇Computer Science #◇CCDSALG #◇Asymptotic Bounds #◇Problem Solving #◇M1
◇Overview
The order of growth characterizes the efficiency of an algorithm, allowing for comparisons with alternative ones. It describes how the running time of an algorithm increases as the size of the input approaches infinity.
When evaluating growth rate functions, the multiplicative constant of the higher-order term is ignored (e.g., O(5n2)=O(n2)), and growth rate functions can be combined using addition (O(f(n))+O(g(n))=O(f(n)+g(n))).
Common types of functions (from slowest to fastest growth):
- Constant O(1): Time is independent of input size.
- Logarithmic O(log2n): Time increases slowly as input size increases.
- Linear O(n): Time increases directly proportionally to input size.
- Linear-logarithmic O(nlog2n): Time increases more rapidly than linear.
- Quadratic O(n2): Time increases rapidly with input size.
- Cubic O(n3): Time increases more rapidly than quadratic.
- Exponential O(2n): Time increases too rapidly to be practical for large inputs.
◇Important Formulas
1. Big-Oh (O-notation)
Represents the worst-case running time. It defines an asymptotically loose upper bound.
O(g(n))={f(n)∣∃c>0,n0>0 such that 0≤f(n)≤cg(n),∀n≥n0}
2. Big-Omega (Ω-notation)
Represents the best-case running time. It defines an asymptotically loose lower bound.
Ω(g(n))={f(n)∣∃c>0,n0>0 such that 0≤cg(n)≤f(n),∀n≥n0}
3. Big-Theta (Θ-notation)
Represents the average-case running time. It defines an asymptotically tight bound (both upper and lower bound).
Θ(g(n))={f(n)∣∃c1,c2>0 and n0>0 such that 0≤c1g(n)≤f(n)≤c2g(n),∀n≥n0}
Note: f(n)=Θ(g(n)) if and only if f(n)=O(g(n)) and f(n)=Ω(g(n)).
4. small-o (o-notation)
Denotes an upper bound that is not asymptotically tight. (e.g., 2n=o(n2), but 2n2=o(n2)).
o(g(n))={f(n)∣∀c>0,∃n0>0 such that 0≤f(n)<cg(n),∀n≥n0}
5. small-omega (ω-notation)
Denotes a lower bound that is not asymptotically tight.
ω(g(n))={f(n)∣∀c>0,∃n0>0 such that 0≤cg(n)<f(n),∀n≥n0}
Note: f(n)=ω(g(n)) if and only if g(n)=o(f(n)).
◇Worked Examples
Example 1: Big-Oh Proof
Is 5n2+150n+750=O(n2)?
Yes. We must find constants c and n0 such that 5n2+150n+750≤cn2.
Dividing both sides by n2: 5+n150+n2750≤c.
If we pick n0=1, then 5+150+750=905≤c. We can choose c=905. (Another valid pair: n0=5,c=65).
Example 2: Negative Big-Oh Proof
Is n3−250n2=O(n2)?
No. We would need to find c such that n3−250n2≤cn2.
Dividing by n2: n−250≤c.
Since n approaches infinity, the left side grows infinitely, so no positive constant c will satisfy the condition for all n≥n0.
Example 3: Big-Omega Proof
Is 5n2+150n+750=Ω(n2)?
Yes. Find positive constants c and n0 such that 5n2+150n+750≥cn2.
Dividing by n2: 5+n150+n2750≥c.
If we pick n0=1, the left side is 905. It remains greater than or equal to 5 as n→∞. So we can let c=5 with n0=1.
Example 4: Another Big-Omega Proof
Is n3−250n2=Ω(n2)?
Yes. Find positive constants c and n0 such that n3−250n2≥cn2.
Dividing by n2: n−250≥c.
If we choose n0=251, then 251−250=1≥c. We can set c=1.
◇References & Navigation